package top.ochiamalu.aioj.enums;

import lombok.Getter;

/**
 * 题目类型enum
 *
 * @author ochiamalu
 * @date 2025/04/26
 */
@Getter
public enum QuestionTypeEnum {
    PROGRAMMING(0, "编程题"),
    MULTIPLE_CHOICE(1, "选择题"),
    JUDGEMENT(2, "判断题"),
    FILL_BLANK(3, "填空题"),
    COMPREHENSIVE(4, "综合题");

    private final int code;
    private final String desc;

    QuestionTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static QuestionTypeEnum getEnumByCode(int code) {
        for (QuestionTypeEnum questionTypeEnum : QuestionTypeEnum.values()) {
            if (questionTypeEnum.getCode() == code) {
                return questionTypeEnum;
            }
        }
        return null;
    }
}
